import { createWebHashHistory, createRouter } from 'vue-router'
import type { RouteRecordRaw } from 'vue-router'
import { errorRoutes } from '@/router/modules/errorRoutes'
import { fullscreenRoutes } from '@/router/modules/fullscreenRoutes'

declare module 'vue-router' {
  interface RouteMeta {
    title?: string; // 菜单标题
    icon?: string;  // 菜单图标
    linkTo?: string; // 外链地址
    cache?: boolean; // 是否缓存
    hidden?: boolean; // 是否在菜单中显示
    isBreadcrumd?: boolean; // 是否显示到面包屑
    isAuth?: boolean; // 菜单标题
    transitionName?: string; // 菜单标题
  }
}

/**
 * 加载路由
 */
const allRoutes: Array<RouteRecordRaw> = [
  ...errorRoutes,
  ...fullscreenRoutes,
];

const router = createRouter({
  history: createWebHashHistory(),
  routes: allRoutes
})

export default router